$(function () {

    var packdata = JSON.parse($("body",parent.document).find("#packdata").val());
    var data = packdata;
    console.log(data)
    var img_url = data.img_url;//顶部图片
    var title = data.title;//标题
    var author = data.speaker_name;//作者
    var time = data.create_time;//发布时间
    var article = data.synopsis;//文章
    var label_name = data.label_name;//标签
    var author_img = data.img;//作者头像

    //图片写入
    var _detailinfo_topimg = $(".detailinfo-topimg");//顶图
    _detailinfo_topimg.attr({"src":img_url});

    //标题写入
    var _detailinfo_title = $(".detailinfo-title");//标题盒子
    _detailinfo_title.html(title);

    //作者写入
    var _detailinfo_author = $(".detailinfo-author");//作者盒子
    var _detailinfo_author_name = $(".detailinfo-author-name");//底部作者盒子
    _detailinfo_author.text(author);
    _detailinfo_author_name.text(author);

    //时间写入
    var _detailinfo_time = $(".detailinfo-time");//时间盒子
    _detailinfo_time.text(time);

    //文章写入
    var _detailinfo_article = $(".detailinfo-article");//文章盒子
    _detailinfo_article.html(article);
    // _detailinfo_article.html(_detailinfo_article.text());

    //写入标签
    var _detailinfo_tagbox = $(".detailinfo-tagbox");//标签盒子
    for(var i = 0; i < label_name.length; i++){
        _detailinfo_tagbox.append(
            '<div class="detailinfo-tag" data-id="' + label_name[i].label_id + '">' +
            '<span>' + label_name[i].label_name + '</span>' +
            '</div>'
        );
    }

    //作者头像写入
    var _detailinfo_author_headimg = $(".detailinfo-author-headimg");//作者头像盒子
    _detailinfo_author_headimg.attr({"style":"background: url(" + author_img + ") no-repeat center; background-size: cover;"});

});